<template>
    <div>
       这是主页的布局页{{ dd }}1111111
       <button @click="b()">跳转b</button>
       <button @click="a()">跳转a</button>
     
       <!-- <router-view></router-view> -->
       <!-- <router-view v-slot="{ Component }">
    <keep-alive>
      <component :is="Component"  :key="$route.name" v-if="$route.meta.keepAlive"/>
    </keep-alive>
    <component :is="Component" :key="$route.name" v-if="!$route.meta.keepAlive"/>
  </router-view>  -->

     <router-view v-slot="{Component}">
        <keep-alive>
            <component :is="Component" :key="$route.name" v-if="$route.meta.keepAlive"/>
        </keep-alive>
        <component :is="Component" :key="$route.name" v-if="!$route.meta.keepAlive"/>
     </router-view>
  
    </div>
</template>

<script setup lang="ts">
import { inject, reactive } from "vue";
import { useRouter } from "vue-router";
const data=reactive({
    name:"这是公共布局主页",
})

const dd=inject("dd")

const router=useRouter();
  function a(){
    router.push("/index/a")
  }

  function b(){
    router.push("/index/b")
  }
</script>

<style scoped>

</style>